<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>欢迎页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/common/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/common/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../../static/css/public.css" media="all">
    <style>
        .layui-card {border:1px solid #f2f2f2;border-radius:5px;}
        .icon {margin-right:10px;color:#1aa094;}
        .icon-cray {color:#ffb800!important;}
        .icon-blue {color:#1e9fff!important;}
        .icon-tip {color:#ff5722!important;}
        .layuimini-qiuck-module {text-align:center;margin-top: 10px}
        .layuimini-qiuck-module a i {display:inline-block;width:100%;height:60px;line-height:60px;text-align:center;border-radius:2px;font-size:30px;background-color:#F8F8F8;color:#333;transition:all .3s;-webkit-transition:all .3s;}
        .layuimini-qiuck-module a cite {position:relative;top:2px;display:block;color:#666;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:14px;}
        .welcome-module {width:100%;height:210px;}
        .panel {background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
        .panel-body {padding:10px}
        .panel-title {margin-top:0;margin-bottom:0;font-size:12px;color:inherit}
        .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top: .3em;}
        .layui-red {color:red}
        .main_btn > p {height:40px;}
        .layui-bg-number {background-color:#F8F8F8;}
        .layuimini-notice:hover {background:#f6f6f6;}
        .layuimini-notice {padding:7px 16px;clear:both;font-size:12px !important;cursor:pointer;position:relative;transition:background 0.2s ease-in-out;}
        .layuimini-notice-title,.layuimini-notice-label {
            padding-right: 70px !important;text-overflow:ellipsis!important;overflow:hidden!important;white-space:nowrap!important;}
        .layuimini-notice-title {line-height:28px;font-size:14px;}
        .layuimini-notice-extra {position:absolute;top:50%;margin-top:-8px;right:16px;display:inline-block;height:16px;color:#999;}
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md8">
                <div class="layui-row layui-col-space15">

                    <!--快捷信息-->
                    <div class="layui-col-md6">
                        <div class="layui-card">
                            <div class="layui-card-header"><i class="fa fa-warning icon"></i>快捷展示</div>
                            <div class="layui-card-body">
                                <div class="welcome-module">
                                    <div class="layui-row layui-col-space10">
                                        <!--温度-->
                                        <div class="layui-col-xs6">
                                            <div class="panel layui-bg-number">
                                                <div class="panel-body">
                                                    <div class="panel-title">
                                                        <span class="label pull-right layui-bg-blue">实时</span>
                                                        <h5>当前温度</h5>
                                                    </div>
                                                    <div class="panel-content">
                                                        <h1 class="no-margins" id="nowtem">暂无温度</h1>
                                                        <small>&nbsp;</small>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!--当前城市-->
                                        <div class="layui-col-xs6">
                                            <div class="panel layui-bg-number">
                                                <div class="panel-body">
                                                    <div class="panel-title">
                                                        <span class="label pull-right layui-bg-cyan">实时</span>
                                                        <h5>当前城市</h5>
                                                    </div>
                                                    <div class="panel-content">
                                                        <h3 class="no-margins" id="now_city">暂无城市信息</h3>
                                                        <small>&nbsp;</small>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!--气候等级-->
                                        <div class="layui-col-xs6">
                                            <div class="panel layui-bg-number">
                                                <div class="panel-body">
                                                    <div class="panel-title">
                                                        <span class="label pull-right layui-bg-orange">实时</span>
                                                        <h5>当前气候</h5>
                                                    </div>
                                                    <div class="panel-content">
                                                        <h1 class="no-margins" id="now_weather">暂无气候</h1>
                                                        <small>&nbsp;</small>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!--湿度-->
                                        <div class="layui-col-xs6">
                                            <div class="panel layui-bg-number">
                                                <div class="panel-body">
                                                    <div class="panel-title">
                                                        <span class="label pull-right layui-bg-green">实时</span>
                                                        <h5>当前湿度</h5>
                                                    </div>
                                                    <div class="panel-content">
                                                        <h1 class="no-margins" id="now_humidity">暂无湿度</h1>
                                                        <small>&nbsp;</small>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!--快捷入口-->
                    <div class="layui-col-md6">
                        <div class="layui-card">
                            <div class="layui-card-header"><i class="fa fa-credit-card icon icon-blue"></i>快捷入口</div>
                            <div class="layui-card-body">
                                <div class="welcome-module">
                                    <div class="layui-row layui-col-space10 layuimini-qiuck">

                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="/schedule/toMySchedule" target="frame" data-title="我的日程" data-icon="fa fa-window-maximize">
                                                <i class="fa fa-window-maximize"></i>
                                                <cite>我的日程</cite>
                                            </a>
                                        </div>

                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="/schedule/toAddSchedule" target="frame" data-title="添加日程" data-icon="fa fa-gears">
                                                <i class="layui-icon layui-icon-form"></i>
                                                <cite>添加日程</cite>
                                            </a>
                                        </div>

                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="/toMap" target="frame" data-title="地图" data-icon="fa fa-file-text">
                                                <i class="layui-icon layui-icon-location"></i>
                                                <cite>地图</cite>
                                            </a>
                                        </div>

                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="/Calendar" target="frame" data-title="日历" data-icon="fa fa-file-text">

                                                <i class="layui-icon layui-icon-date"></i>
                                                <cite>日历</cite>
                                            </a>
                                        </div>

                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="/toSwagger" target="frame" data-title="系统设置" data-icon="fa fa-gears">
                                                <i class="fa fa-gears"></i>
                                                <cite>系统接口</cite>
                                            </a>
                                        </div>

                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="page/404.html" data-title="404页面" data-icon="fa fa-hourglass-end">
                                                <i class="fa fa-hourglass-end"></i>
                                                <cite>404页面</cite>
                                            </a>
                                        </div>

                                        <!--<div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="https://www.baidu.com" target="frame" data-title="百度搜索" data-icon="fa fa-search">
                                                <i class="fa fa-search"></i>
                                                <cite>百度搜索</cite>
                                            </a>
                                        </div>-->
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <!--天气echart表-->
                    <div class="layui-col-md12">
                        <div class="layui-card">
                            <div class="layui-card-header"><i class="fa fa-line-chart icon"></i>天气信息</div>
                            <div class="layui-card-body">
                                <div id="echarts-records" style="width: 100%;min-height:500px"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md4">

                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-bullhorn icon icon-tip"></i>项目进度</div>
                    <div class="layui-card-body layui-text">
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">添加首页信息展示及对应接口的调试</div>
                            <div class="layuimini-notice-extra">2019-07-11 23:06</div>
                        </div>
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">添加地图模块</div>
                            <div class="layuimini-notice-extra">2019-07-11 23:06</div>
                        </div>
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">实现日程增删改查的基本实现</div>
                            <div class="layuimini-notice-extra">2019-07-11 12:57</div>
                        </div>
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">完成登录注册等基本功能</div>
                            <div class="layuimini-notice-extra">2019-07-05 14:28</div>
                        </div>
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">构建后端框架</div>
                            <div class="layuimini-notice-extra">2019-07-04 11:02</div>
                        </div>
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">完成前端基础UI编写</div>
                            <div class="layuimini-notice-extra">2019-06-17 11:55</div>
                        </div>
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">针对系统进行需求分析</div>
                            <div class="layuimini-notice-extra">2019-06-13 14:53</div>
                        </div>
                    </div>
                </div>

                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-fire icon"></i>版本信息</div>
                    <div class="layui-card-body layui-text">
                        <table class="layui-table">
                            <colgroup>
                                <col width="100">
                                <col>
                            </colgroup>
                            <tbody>
                            <tr>
                                <td>项目名称</td>
                                <td>
                                    个人日程管理系统
                                </td>
                            </tr>
                            <tr>
                                <td>当前版本</td>
                                <td>v1.0.0</td>
                            </tr>
                            <tr>
                                <td>班级名称</td>
                                <td>
                                    软件2132
                                </td>
                            </tr>
                            <tr>
                                <td>组长</td>
                                <td>张  潇</td>
                            </tr>
                            <tr>
                                <td>组员</td>
                                <td>
                                    刘康乐 施峻译 郭焜
                                </td>
                            </tr>
                            <tr>
                                <td>指导教师</td>
                                <td>
                                    孟东霞
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>


            </div>
        </div>
    </div>
</div>
<script src="../../static/common/layui/layui.js"></script>
<script src="../../static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="../../static/common/jquery.min.js"></script>
<script src="../../static/js/echarts.js"></script>
<script>
    window.onload=function(){
        //获取当前天气数据
        $.ajax({
            url: 'https://www.mxnzp.com/api/weather/current/%E5%A4%AA%E5%8E%9F%E5%B8%82?app_id=tjnrsuptvjkvw1oi&app_secret=z9IXpz2KQFHqHjsm8ubwb97xxoeOlFFV',
            method: 'get',
            contentType: 'application/json;charset=UTF-8',
            dataType: 'json',
            success: function (res) {
                if (res.code===1){
                    const tem = document.getElementById("nowtem");
                    const now_city = document.getElementById("now_city");
                    const now_weather = document.getElementById("now_weather");
                    const now_humidity = document.getElementById("now_humidity");
                    tem.innerText=res.data.temp;
                    now_city.innerText=res.data.address;
                    now_weather.innerText=res.data.weather;
                    now_humidity.innerText=res.data.humidity;
                }else {
                    console.log(res);
                }
            },
            error: function (data) {
                console.log(data);
            }
        });


        /**
         * 初始化气候表
         */
        var chartDom = document.getElementById('echarts-records');
        var myChart = echarts.init(chartDom);
        var option;

        option = {
            title: {
                text: '当地未来七天温度变化表'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {},
            xAxis: {
                type: 'category',
                data: []
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    formatter: '{value} °C'
                }
            },
            series: [
                {
                    name: 'Highest',
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            { type: 'max', name: 'Max' },
                            { type: 'min', name: 'Min' }
                        ]
                    },
                    markLine: {
                        data: [{ type: 'average', name: 'Avg' }]
                    }
                },
                {
                    name: 'Lowest',
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            { type: 'max', name: 'Max'},
                            { type: 'min', name: 'Min' }
                        ]
                    },
                    markLine: {
                        data: [
                            { type: 'average', name: 'Avg' },
                            [
                                {
                                    symbol: 'none',
                                    x: '90%',
                                    yAxis: 'max'
                                },
                                {
                                    symbol: 'circle',
                                    label: {
                                        position: 'start',
                                        formatter: 'Max'
                                    },
                                    type: 'max',
                                    name: '最高点'
                                }
                            ]
                        ]
                    }
                }
            ]
        };

        /**
         * 获取未来七天天气数据并将数据整理填入图表
         * 以山西省太原市尖草坪区为例
         */

        $.ajax({
            url: 'https://devapi.qweather.com/v7/weather/7d?key=e9bea602845c40e5beedeb85eb7ebf29&location=101100106',
            method: 'get',
            contentType: 'application/json;charset=UTF-8',
            dataType: 'json',
            success: function (res) {
                const maxTem = [];
                const minTem = [];
                const day = [];
                console.log(res.daily);
                var index = 0;
                while(index<7){
                    maxTem.push(res.daily[index].tempMax);
                    minTem.push(res.daily[index].tempMin);
                    day.push(res.daily[index].fxDate);
                    index+=1;
                }
                myChart.setOption({
                    xAxis:{
                        data: day
                    },
                    series: [
                        {
                            name: 'Highest',
                            data: maxTem,
                        },
                        {
                            name: 'Lowest',
                            data: minTem,
                        }
                    ]
                })
            }
        });

        myChart.setOption(option);
    }

</script>
<script>
    layui.use(['layer', 'miniTab','echarts'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            miniTab = layui.miniTab,
            echarts = layui.echarts;

        miniTab.listen();

        /**
         * 查看公告信息
         **/
        $('body').on('click', '.layuimini-notice', function () {
            var title = $(this).children('.layuimini-notice-title').text(),
                noticeTime = $(this).children('.layuimini-notice-extra').text(),
                content = $(this).children('.layuimini-notice-content').html();
            var html = '<div style="padding:15px 20px; text-align:justify; line-height: 22px;border-bottom:1px solid #e2e2e2;background-color: #2f4056;color: #ffffff">\n' +
                '<div style="text-align: center;margin-bottom: 20px;font-weight: bold;border-bottom:1px solid #718fb5;padding-bottom: 5px"><h4 class="text-danger">' + title + '</h4></div>\n' +
                '<div style="font-size: 12px">' + content + '</div>\n' +
                '</div>\n';
            parent.layer.open({
                type: 1,
                title: '系统公告'+'<span style="float: right;right: 1px;font-size: 12px;color: #b1b3b9;margin-top: 1px">'+noticeTime+'</span>',
                area: '300px;',
                shade: 0.8,
                id: 'layuimini-notice',
                btn: ['查看', '取消'],
                btnAlign: 'c',
                moveType: 1,
                content:html,
                success: function (layero) {
                    var btn = layero.find('.layui-layer-btn');
                    btn.find('.layui-layer-btn0').attr({
                        href: 'https://gitee.com/zhongshaofa/layuimini',
                        target: '_blank'
                    });
                }
            });
        });

        /**
         * 天气表
         */
        var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
        var optionRecords = {
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['周一','周二','周三','周四','周五','周六','周日']
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    name:'邮件营销',
                    type:'line',
                    data:[120, 132, 101, 134, 90, 230, 210]
                },
                {
                    name:'联盟广告',
                    type:'line',
                    data:[220, 182, 191, 234, 290, 330, 310]
                },
                {
                    name:'视频广告',
                    type:'line',
                    data:[150, 232, 201, 154, 190, 330, 410]
                },
                {
                    name:'直接访问',
                    type:'line',
                    data:[320, 332, 301, 334, 390, 330, 320]
                },
                {
                    name:'搜索引擎',
                    type:'line',
                    data:[820, 932, 901, 934, 1290, 1330, 1320]
                }
            ]
        };
        echartsRecords.setOption(optionRecords);

        // echarts 窗口缩放自适应
        window.onresize = function(){
            echartsRecords.resize();
        }

    });

</script>

</body>
</html>
